package com.example.sandbox.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.sandbox.dto.domain.PayOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 支付订单表 Mapper 接口
 *
 * @author liuxinxin
 * @since 2024-05-14
 */
@Mapper
public interface PayOrderMapper extends BaseMapper<PayOrder> {

    /**
     * 根据订单 ID 更新订单状态
     *
     * @param orderId 订单 ID
     * @param state   新的状态值
     */
    int updateByOrderId(@Param("orderId") String orderId, @Param("state") byte state);

    /**
     * 查询支付订单
     *
     * @param mchNo       商户号
     * @param mchOrderNo  商户订单号
     * @param payOrderId  支付订单号
     * @return 订单列表
     */
    PayOrder queryPayOrderMch(
            @Param("mchNo") String mchNo,
            @Param("mchOrderNo") String mchOrderNo,
            @Param("payOrderId") String payOrderId
    );
}
